package xjvm_v1.classfile.cons;


import xjvm_v1.classfile.ConsPoolInfo;
import xjvm_v1.util.TypeTransUtil;
import xjvm_v1.util.U2;

public class ConstantNameandtype extends ConstantBase {
    public U2 nameIndex;
    public U2 descriptorIndex;


    public String handle(ConstantBase[] cpInfo){

        Integer intIndexOfName = TypeTransUtil.byteArr2Int(nameIndex.u2);
        String fieldName = cpInfo[intIndexOfName].handle(cpInfo);

        Integer intIndexOfDescriptor = TypeTransUtil.byteArr2Int(descriptorIndex.u2);
        String descriptor = cpInfo[intIndexOfDescriptor].handle(cpInfo);
        return fieldName + ": " + descriptor;
    }


}
